package com.sample.tdf.domain;

import cn.com.taiji.common.base.IBaseRepository;
import cn.com.taiji.common.base.IBaseTreeRepository;
import com.sample.tdf.dto.EmpOrgDTO;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface OrganizationRepository extends IBaseRepository<Organization>, IBaseTreeRepository<Organization> {
    String jpsql= " FROM Organization t1 LEFT JOIN EmpOrg t2 ON t1.id = t2.orgId LEFT JOIN Employee t3 ON t2.empId = t3.id";
    @Query(value = "SELECT new com.sample.tdf.dto.EmpOrgDTO(t1.id, t1.parentId,t1.orgName ,t3.id,t3.empName)"+jpsql)
    List<EmpOrgDTO> findAllEmpOrgDTO();
}
